package marking.liu.exceptionHandler;

import lombok.extern.slf4j.Slf4j;
import marking.liu.exception.BaseException;
import marking.liu.pojo.vo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandle {

    /**
     * 全局异常捕获
     * @param baseException
     * @return
     */
    @ExceptionHandler
    public Result baseExceptionHandler(BaseException baseException) {
        log.info(baseException.getMessage());
        return Result.error(baseException.getMessage());
    }
}
